package com.kancy.spring.sample.event;

import com.kancy.spring.boot.ApplicationRunner;
import com.kancy.spring.context.annotation.Component;
import com.kancy.spring.context.annotation.Order;
import com.kancy.spring.context.annotation.Profile;
import com.kancy.spring.context.event.PayloadApplicationEvent;
import com.kancy.spring.utils.SpringUtils;

/**
 * SimpleApplicationEventRunner
 *
 * @author kancy
 * @date 2020/2/18 12:50
 */
@Order(2)
@Component
@Profile({"dev"})
public class SimpleApplicationEventRunner implements ApplicationRunner {
    @Override
    public void run(String[] args) throws Exception {
        SpringUtils.publishEvent(new SimpleApplicationEvent("I am SimpleApplicationEvent."));
        SpringUtils.publishEvent(new PayloadApplicationEvent<String>("I am PayloadApplicationEvent."));
    }
}
